import { defineStore } from 'pinia'
import { type DictData } from '@/api/power/dict'

const useDictStore = defineStore('dict', () => {
  const dict = ref<Record<string, DictData[]>>({})

  function getDict(key: string) {
    return dict.value[key] || null
  }

  function setDict(key: string, data: DictData[]) {
    dict.value[key] = data
  }

  return { getDict, setDict }
})

export default useDictStore
